import axios from 'axios';

function checkStatus(response) {
    if (response.status >= 200 && response.status < 300) {
        return response;
    }

    const error = new Error(response.statusText);
    error.response = response;
    throw error;
}

export default function request(url, options) {
    return axios.get(`${url}`)
        .then(checkStatus)
        // .then(parseJSON)
        .then((data) => {
            // console.log(data.data)
            return data.data
        })
        .catch((err) => ({err}));
}
